package com.oschina.lazy.unsafe;

/**
 * @author zhouyang
 * @Date 2017-08-19 17:28
 * @Description 懒汉式线程不安全的,当过个线程同时的调用getSingleton()则可能会创建多个实例。
 * @Version 1.0
 */
public class Singleton {

    private static Singleton singleton;

    private Singleton(){

    }

    public static Singleton getSingleton() {
        if(singleton == null){
            singleton = new Singleton();
        }
        return singleton;
    }
}
